﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TinyCinema.UI.Pages.Customer._Information
{
    /// <summary>
    /// Interaction logic for FormView.xaml
    /// </summary>
    public partial class FormView : Page
    {
        public FormView()
        {
            InitializeComponent();
            DataContext = Information.dataContext;
            (DataContext as Bussiness.Customer.Customer).Messenger.Register<Bussiness.Customer.Message.BackConfimation>(this, ShowMessageBox1);
            (DataContext as Bussiness.Customer.Customer).Messenger.Register<Bussiness.Customer.Message.BackConfimationOK>(this, (s) => MainPage.pagInformation.FormViewModeHandle());
            (DataContext as Bussiness.Customer.Customer).Messenger.Register<Bussiness.Customer.Message.DeleteFailed>(this, ShowMessageBox2);
            (DataContext as Bussiness.Customer.Customer).Messenger.Register<Bussiness.Customer.Message.DeleteConfirmation>(this, ShowMessageBox3);
            (DataContext as Bussiness.Customer.Customer).Messenger.Register<Bussiness.Customer.Message.ResetPasswordConfimation>(this, ShowMessageBox4);
            (DataContext as Bussiness.Customer.Customer).Messenger.Register<Bussiness.Customer.Message.ResetPasswordFailed>(this, ShowMessageBox5);
            (DataContext as Bussiness.Customer.Customer).Messenger.Register<Bussiness.Customer.Message.ResetPasswordOK>(this, ShowMessageBox6);
          
        }
        void ShowMessageBox1(Bussiness.Customer.Message.BackConfimation s)
        {
            s.Result = MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langMsgExit") as String), "", MessageBoxButton.YesNo);
        }
        void ShowMessageBox2(Bussiness.Customer.Message.DeleteFailed s)
        {
            MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langMsgCustomerNotDelete") as String), "", MessageBoxButton.OK);
        }
        void ShowMessageBox3(Bussiness.Customer.Message.DeleteConfirmation s)
        {
            s.Result = MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langMsgCustomerDelete") as String), "", MessageBoxButton.YesNo);
        }
        void ShowMessageBox4(Bussiness.Customer.Message.ResetPasswordConfimation s)
        {
            s.Result = MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langMsgChangePass") as String), "", MessageBoxButton.YesNo);
        }
        void ShowMessageBox5(Bussiness.Customer.Message.ResetPasswordFailed s)
        {
            s.Result = MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langMsgChangePassFail") as String), "", MessageBoxButton.OK);
        }
        void ShowMessageBox6(Bussiness.Customer.Message.ResetPasswordOK s)
        {
            s.Result = MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langResetPasswordOK") as String), "", MessageBoxButton.OK);
        }
        public static TradeLog pagTradeLog = new TradeLog();
        private void TradeLog_Click(object sender, RoutedEventArgs e)
        {
            MainPage.pagInformation.pagContentFrameSource = pagTradeLog;
        }
        
    }
}
